class Solution {
    public String modifyString(String s) {
        char[] str=s.toCharArray();


        for(int i=0;i<str.length;i++){
            for(char ch='a';ch<'z';ch++){

                if(str[i]!='?') break;

                if((i==0||str[i-1]!=ch)&&(i==str.length-1||str[i+1]!=ch)){
                    str[i]=ch;
                }
            }

        }
        return String.valueOf(str);
    }
}

class Solution1 {
    public int findPoisonedDuration(int[] timeSeries, int duration) {
        int n=timeSeries.length;
        int i=0;
        int count=0;


        while(i<n-1){
            int x=timeSeries[i+1]-timeSeries[i];
            if(x>=duration) count+=duration;
            else count+=x;
            i++;

        }

        return count+duration;


    }
}
